package java_class_work.week02;

/**
 * @Author Tiam
 * @Date 2022/9/19 11:24
 * @Description: 水仙花数
 */
public class Demo03 {
    public static void main(String[] args) {
        suixianhua();
    }

    public static void suixianhua() {
        for (int i = 100; i < 1000; i++) {
            if(isDaffodils(i)) System.out.println(i);
        }
    }

    static boolean isDaffodils(int num){
        int g = num%10;
        int s = num/10%10;
        int b = num/100;
        if(g*g*g+s*s*s+b*b*b==num){
            return true;
        }
        return false;
    }
}
